import http from '@/http/api.js'

export const getData = (data) => {
  return http.request({
    url: 'http://127.0.0.1:3000/user/users',
    method: 'post',
    data
  })
}

export const register = (data) => {
  return http.request({
    url: 'http://127.0.0.1:3000/user/register',
    method: 'post',
    data 
  })
}

export const login = (data) => {
  return http.request({
    url: 'http://127.0.0.1:3000/user/login',
    method: 'post',
    data
  })
}
export const updateUser = (id, data) => {
  return http.request({
    url: `http://127.0.0.1:3000/user/${id}`,
    method: 'post',
    data
  })
}

// 判断用户密码
export const checkPassword = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/user/check`,
    method: 'post',
    data
  })
}

export const addHealth = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/health/add`,
    method: 'post',
    data
  })
}

export const getHealth = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/health/get`,
    method: 'post',
    data
  })
}


export const updateHealth = (id, data) => {
  return http.request({
    url: `http://127.0.0.1:3000/health/${id}`,
    method: 'post',
    data
  })
}

export const addPeriod = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/period/add`,
    method: 'post',
    data
  })
}

export const getPeriod = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/period/get`,
    method: 'post',
    data
  })
}


export const updatePeriod = (id, data) => {
  return http.request({
    url: `http://127.0.0.1:3000/period/${id}`,
    method: 'post',
    data
  })
}

export const addMenu = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/menu/add`,
    method: 'post',
    data
  })
}

export const getMenu = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/menu/get`,
    method: 'post',
    data
  })
}

export const getUser = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/user/get`,
    method: 'post',
    data
  })
}